<?php

	require_once APPPATH . 'controllers/base_controllers/base_controller.php';
	
	class api_helper extends Base_controller
	{
		public function __construct()
		{
			parent::__construct();
		}
		
		
		public function index()
		{
			
		}
		
		
		public function random_password()
		{
			$this->load->library('encrypt');
			
			$chars = "abcdefghijkmnopqrstuvwxyz023456789";
    		srand((double)microtime()*1000000);

    		$i = 0;
    		$pass = '' ;

		    while ($i <= 5)
			{
		        $num = rand() % 33;
		        $tmp = substr($chars, $num, 1);
        		$pass = $pass . $tmp;
		
		        $i++;
		    }
			
			$randomPassword = $pass;			
			$encryptedPassword = $this->encrypt->encode($pass);
			
			echo( $randomPassword . ' | ' . $encryptedPassword);
			
			
			die;
		}
		
		
		public function home_url()
		{
			
			echo(uniqid());
			
			die;
		}
		
		
		public function encrypt_password($password)
		{
			$this->load->library('encrypt');
			
			$encryptedPassword = $this->encrypt->encode($password);
			
			echo( $password . ' | ' . $encryptedPassword);
			
			die;
		}
/*		
		public function decrypt_password($password)
		{
			$this->load->library('encrypt');
			
			$decryptedPassword = $this->encrypt->decode($password);
			
			echo( $password . ' | ' . $decryptedPassword);
			
			die;
		} */
	}

?>